home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
tcoop10a.zip
/
DOC.ZIP
/
STRING.DOC
< prev
next >
Wrap
Text File
|
1991-11-20
|
5KB
|
125 lines
STRING.DOC 11/10/91 Copyright (c) 1991 by James S. Clark
==========================================================================
STRING
String Class
--------------------------------------------------------------------------
Class Name String
Superclass <none>
Category String
Other classes referenced <none>
Other catagories referenced <none>
Used by ???
Inherited by <none>
Declaration String *s = new String;
Instance Variables
int len;
char *str;
Instance Methods
String (char *);
String (int);
String ();
~String ();
int length ();
void print ();
operator == (String& s);
operator == (char *s);
operator > (String& s);
operator > (char *s);
operator >= (String& s);
operator >= (char *s);
operator < (String& s);
operator < (char *s);
operator <= (String& s);
operator <= (char *s);
String& operator = (const String& s);
String& operator = (const char *);
String& operator + (const String& s);
String& operator + (const char *);
String& operator += (const String& s);
String& operator += (const char *);
String& operator << (const String& s);
String& operator << (const char *);
char& operator [] (int index);
--------------------------------------------------------------------------
GENERAL DESCRIPTION
The String Class provides a number of operators for working strings. The
String Class has operations for comparing, concatenating, and testing
string objects with other strings or standard character arrays.
--------------------------------------------------------------------------
VARIABLES
int len;
This variable holds the length of the string.
char *str;
This is a pointer to the beginning of the string.
--------------------------------------------------------------------------
METHODS
String (char *);
This constructor creates a string and assigns a character array to
it. Example: String s("Text") assigns "Text" to string s.
String (int);
This constructor creates a string with the size given as an integer.
For example: String s(256) creates a string of 256 characters.
String ();
This constructor creates a NULL string of size zero. The value can
be assigned later. Example: String s;
~String (); // delete s;
String destructor method.
int length ();
Returns with the length of the string.
void print ();
Display the string, including a newline at the end.
operator == (String& s); // equality
operator == (char *s);
operator > (String& s); // greater than
operator > (char *s);
operator >= (String& s); // greater than or equal
operator >= (char *s);
operator < (String& s); // less than
operator < (char *s);
operator <= (String& s); // less than or equal
operator <= (char *s);
This group of operators allows equivalency testing of strings
and string, or string and character array. They call the C
function strcmp().
String& operator = (const String& s); // copy
String& operator = (const char *); // copy
These equal sign causes the contents of the string or character
array on the right hand side of the equals, to be copied into
the string on the left hand side of the equation.
String& operator + (const String& s); // concat
String& operator + (const char *); // concat
String& operator += (const String& s); // concat
String& operator += (const char *); // concat
String& operator << (const String& s); // concat
String& operator << (const char *); // concat
These operators cause the string or character array on the right
side of the operation to be appended to the end of the string on
the left side of the operation.
char& operator [] (int index);
This operator allows string indexing that conforms to the method
usually used in character arrays.
--------------------------------------------------------------------------
STRING.DOC Copyright (c) 1991 by James S. Clark
==========================================================================